package day4;

import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class MapSort {
    public static void main(String[] args) {
        Map<Character,Integer> map=new HashMap<>();
        map.put('路',3);
        map.put('刘',14);
        map.put('网',33);
        map.put('F',5);
        map.put('J',2);
        Set<Map.Entry<Character, Integer>> er = map.entrySet();
        List<Map.Entry<Character, Integer>> list=new ArrayList<>(er);
        Collections.sort(list,new MapCompartor());
        for(Map.Entry<Character, Integer> m:list){
            System.out.println(m);
        }
    }


}
  class MapCompartor implements Comparator<Map.Entry<Character, Integer>> {
      @Override
      public int compare(Map.Entry<Character, Integer> o1, Map.Entry<Character, Integer> o2) {
          return o2.getValue()-o1.getValue();
      }
  }